<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            关爱帮后台管理
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="./css/x-admin.css" media="all">
    </head>
   <body style="display: none" class="body" ng-app="gab" ng-controller="login" ng-init="login();"> 
      
   
        <div class="layui-layout layui-layout-admin">
            <div class="layui-header header header-demo">
                <div class="layui-main">
                    <a class="logo" href="./index.html">
                           关爱帮后台管理
                    </a>
                    <ul class="layui-nav" lay-filter="">
                      <li class="layui-nav-item"><img src="./images/logo.png" class="layui-circle" style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                      <li class="layui-nav-item">
                        <a href="javascript:;">关爱帮用户</a>
                        <dl class="layui-nav-child"> <!-- 二级菜单 -->
                          <dd><a href="">个人信息</a></dd>
                          <dd><a href="" onClick="myselfinfo()">修改密码</a></dd><!-- onClick="myselfinfo()" -->
                          <dd><a href="../index.html">退出</a></dd>
                        </dl>
                      </li>
                      <!-- <li class="layui-nav-item">
                        <a href="" title="消息">
                            <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                        </a>
                        </li> -->
                      <li class="layui-nav-item x-index"><a href="/">前台首页</a></li>
                    </ul>
                </div>
            </div>
            <div class="layui-side layui-bg-black x-side">
                <div class="layui-side-scroll">
                    <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                        <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">&#xe607;</i><cite>公司管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="./company-list.html">
                                            <cite>公司信息</cite>
                                        </a>
                                    </dd>
                                </dd>
                                <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="./introduct-list.html">
                                            <cite>公司介绍</cite>
                                        </a>
                                    </dd>
                                </dd>
                            </dl>
                        </li>
                        <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">&#xe62d;</i><cite>联系我们</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="./contact-list.html">
                                            <cite>联系我们</cite>
                                        </a>
                                    </dd>
                                </dd>
                                <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="./recruit-list.html">
                                            <cite>招聘信息</cite>
                                        </a>
                                    </dd>
                                </dd>
                                
                            </dl>
                        </li>
                        <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">&#xe634;</i><cite>轮播管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="./banner-list.html">
                                            <cite>轮播列表</cite>
                                        </a>
                                    </dd>
                                </dd>
                            </dl>
                        </li>
                       
                        <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">&#xe612;</i><cite>会员管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd class="">
                                    <a href="javascript:;" _href="user-list.html">
                                        <cite>会员列表</cite>
                                    </a>
                                </dd>
                               
                            </dl>
                        </li>
                      <!--    <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">&#xe613;</i><cite>管理员管理</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd class="">
                                    <a href="javascript:;" _href="./admin-list.html">
                                        <cite>管理员列表</cite>
                                    </a>
                                </dd>
                                <dd class="">
                                    <a href="javascript:;" _href="./admin-role.html">
                                        <cite>角色管理</cite>
                                    </a>
                                </dd>
                                <dd class="">
                                    <a href="javascript:;" _href="./admin-cate.html">
                                        <cite>权限分类</cite>
                                    </a>
                                </dd>
                                <dd class="">
                                    <a href="javascript:;" _href="./admin-rule.html">
                                        <cite>权限管理</cite>
                                    </a>
                                </dd>
                            </dl>
                        </li>
                        -->
                        <li class="layui-nav-item" style="height: 30px; text-align: center">
                        </li>
                    </ul>
                </div>

            </div>
            <div class="layui-tab layui-tab-card site-demo-title x-main" lay-filter="x-tab" lay-allowclose="true">
                <div class="x-slide_left"></div>
                <ul class="layui-tab-title">
                    <li class="layui-this">
                        我的桌面
                        <i class="layui-icon layui-unselect layui-tab-close">ဆ</i>
                    </li>
                </ul>
                <div class="layui-tab-content site-demo site-demo-body">
                    <div class="layui-tab-item layui-show">
                        <iframe frameborder="0" src="./welcome.html" class="x-iframe"></iframe>
                    </div>
                </div>
            </div>
            <div class="site-mobile-shade">
            </div>
        </div>
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script src="./js/x-admin.js"></script>
        <!-- 引入 angular 文件 -->
		<script type="text/javascript" src="plugins/angularjs/angular.min.js"></script>
		<script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
		<link rel="stylesheet" href="layui/css/layui.css"  media="all">
        <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
        
        
			//验证密码登录
			var app = angular.module("gab", []);
			app.controller("login", function($scope, $http) {
				var a = 0;
				$scope.login = function() {
				
					if(sessionStorage.getItem('loginState') != 'true') { //获取存储的登录状态
						var password = prompt("请输入密码!");
						$http.get('../login/login.action?password=' + password).success(
							function(response) {
								if(response == 'true') {
									alert("请再次按回车键.....");
									/* alert("登录成功!"); */
									$(".body").css('display','block');
									sessionStorage.setItem('loginState', true);
									window.location.href="./index.html";
									
								} else {
									alert("密码错误!");
									if(a < 3){
										$scope.login();
										a++;
									}
								}
							}
						);
					} else {
						$(".body").show();
					}

				}

				//退出登录
				$scope.logout = function() {
					sessionStorage.setItem('loginState', false);
					window.location = "../index.html";
				}

				//更改密码
				$scope.updatePassword = function(oldPassword, newPassword, newPassword1) {
					alert(oldPassword);
					alert(newPassword);
					alert(newPassword1);
					$http.get('../login/updatePassword.action?oldPassword=' + oldPassword + '&newPassword=' + newPassword).success(
						function(response) {
							alert(response);
						}
					);
				}
			});

			function updatePassword() {
				var oldPassword = $("#oldPassword")[0].value;
				var newPassword = $("#newPassword")[0].value;
				var newPassword1 = $("#newPassword1")[0].value;
				if(newPassword == newPassword1) {
					$.ajax({
						url: '../login/updatePassword.action?oldPassword=' + oldPassword + '&newPassword=' + newPassword,
						type: 'POST',
						async: false,
						data: null,
						cache: false,
						contentType: false, //不可缺
						processData: false, //不可缺
						success: function(data) {
							if(data.success) {
								alert(data.message);
								sessionStorage.setItem('loginState', null); //重新登录
								window.location = "index.html";
							} else {
								alert(data.message);
							}
						}
					});
				}else{
					alert("密码不一致!");
				}

			}
			layui.use('layer ', function(){
				var layer = layui.layer ;
				});
			function myselfinfo() {
				debugger
				alert();
				layer.open({
					type: 1,
					area: ['300px', '200px'],
					fix: false, //不固定
					maxmin: true,
					shade: 0.4,
					title: '查看信息',
					content: '原密码 :   <input type="text" id="oldPassword" /><br /> 新密码 :   <input type="text" id="newPassword" /><br /> 确认密码 : <input type="text" id="newPassword1" /> <input type="button" value="更改" onclick="updatePassword()" />'
				});
			}
        </script>
    </body>
</html>